package com.dykj.fireFighting.web.controller;

import com.dykj.fireFighting.api.elasticsearch.devHisWater.entity.EsDevHisWater;
import com.dykj.fireFighting.api.elasticsearch.devHisWater.service.EsDevHisWaterService;
import com.dykj.fireFighting.api.monitoringCenter.dto.DevHisWaterDto;
import com.dykj.fireFighting.api.monitoringCenter.entity.DevHisWater;
import com.dykj.fireFighting.api.monitoringCenter.service.IDevHisWaterService;
import com.dykj.fireFighting.common.core.annotation.AutoLog;
import com.dykj.fireFighting.common.core.api.CommonResult;
import com.dykj.fireFighting.common.core.vo.PageVo;
import com.dykj.fireFighting.web.base.shiro.ShiroUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 消防水设备运行记录接口
 *
 * @Author fgc
 * @Date  2021-06-18 16:49:50
 */
@Slf4j
@Api(value = "消防水设备运行记录接口", tags = {"消防水设备运行记录接口"})
@RestController
@RequestMapping("devHisWater")
public class DevHisWaterController {
   @DubboReference
    private IDevHisWaterService devHisWaterService;
   @DubboReference
   private EsDevHisWaterService esDevHisWaterService;


    /**
     * 消防水设备运行记录列表
     *
     * @return
     */
    @AutoLog(value = "消防水设备运行记录接口-分页列表查询")
    @ApiOperation(value = "消防水设备运行记录接口分页列表", notes = "消防水设备运行记录接口分页列表")
    @GetMapping("/list")
    @RequiresPermissions("devHisWater/list")
    public CommonResult<PageVo<EsDevHisWater>> treeGrid(DevHisWaterDto devHisWaterDto) {
        Long enterpriseId = ShiroUtil.getUser().getEnterpriseId();
        PageVo<EsDevHisWater> page = esDevHisWaterService.centerSearch(enterpriseId.toString(), devHisWaterDto.getSocialUnitId(), devHisWaterDto.getDevName(),
                (int) devHisWaterDto.getPage(), (int) devHisWaterDto.getLimit(),devHisWaterDto.getBeginDate(),devHisWaterDto.getEndDate());
        return CommonResult.success(page);
    }

    /**
     * 获取消防水设备运行记录信息
     */
    /*@AutoLog(value = "消防水设备运行记录接口-获取VIEW信息")
    @ApiOperation(value = "获取消防水设备运行记录接口信息", notes = "获取消防水设备运行记录接口信息")
    @ApiImplicitParam(paramType = "path", name = "id", value = "主键ID", dataType = "Long", required = true)
    @GetMapping("/info/{id}")
    @RequiresPermissions("devHis/devHisWaterRecord/info")
    public CommonResult<DevHisWaterRecord> info(@PathVariable("id") Long id){
        DevHisWaterRecord devHisWaterRecord = devHisWaterService.getById(id);
        return CommonResult.success(devHisWaterRecord);
    }*/

}
